package com.codi.api.xxljob;

import com.codi.bus.core.service.MessageService;
import com.codi.bus.core.service.TradeSyncService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author lvgo
 * @version 1.0
 * @Description: 交易状态同步, 并发送短信
 * 0 0 19 * * ?
 * @date 18-6-29 下午4:43
 */
@Slf4j
@Component
@JobHandler("tradeStatusSyncHandler")
public class TradeStatusSyncHandler extends IJobHandler {
    @Resource
    private TradeSyncService tradeSyncService;
    @Resource
    private MessageService messageService;

    @Override
    public ReturnT<String> execute(String s) throws Exception {
        log.info("trade status sync");
        tradeSyncService.syncHundsun();
        messageService.getPortfolioFundMessage();
        XxlJobLogger.log("TradeStatusSync-JOB, success");
        return SUCCESS;
    }
}
